package com.xgsm.springsecurityauthdemo.Controllers;

import com.xgsm.springsecurityauthdemo.Service.LoginService;
import com.xgsm.springsecurityauthdemo.domain.ResponseResult;
import com.xgsm.springsecurityauthdemo.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {
    @Autowired
    LoginService loginService;

    @PostMapping("/user/login")
    public ResponseResult login(@RequestBody User user){
        return loginService.login(user);
    }


    @PostMapping("/user/loginout")
    public ResponseResult loginOut(){
        return loginService.loginOut();
    }

}
